package ar.pmt.vista.decoradores;

import java.text.DecimalFormat;

import javax.servlet.jsp.PageContext;

import org.displaytag.decorator.DisplaytagColumnDecorator;
import org.displaytag.exception.DecoratorException;
import org.displaytag.properties.MediaTypeEnum;

public class DecimalWrapper implements DisplaytagColumnDecorator
{
    private DecimalFormat decimalFormat;

    public DecimalWrapper()
    {
        decimalFormat = new DecimalFormat("#,###,###0.00");
    }

    public Object decorate(Object columnValue, PageContext pageContext, MediaTypeEnum media)
        throws DecoratorException
    {
        Float decimal = (Float)columnValue;
        if (decimal==null) {

            return "";



        }
        return decimalFormat.format(decimal);
    }

}